﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BankBillSum.aspx.cs" Inherits="Thksoft.Module.BillManagement.BankBillSum" %>

<!DOCTYPE html>
<html class="L_UI">
<head id="Head1" runat="server">
    <title>银行票据汇总</title>
    <link href="/CSS/Main.css" rel="stylesheet" type="text/css" />
    <link href="/UserCotrols/My97DatePicker/skin/WdatePicker.css" rel="stylesheet" type="text/css" />
    <script src="/UserCotrols/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <script src="../../Scripts/jquery-1.7.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        var option = {};
        option.Area = ["1020px", "730px"];

        option.CancelCallback = function (index, layero) {
            //刷新页面
            //location.href = location.href;
            $("#btnSelect").click();
        };

        function FORM_EDIT(id, type) {
            option.Url = "../Modal/BankBillsLedgerEdit.aspx?ID=" + id + "&Type=" + type;
            option.Title = "票据汇总编辑";
            top.MessageBox.Load(option);
        }
        function btnEdit_Click() {
            var data = GET_CHECKS();
            if (data.length == 1) {
                if (confirm("是否编辑?")) {
                    FORM_EDIT(data[0].Key, data[0].Type);
                }
            }
            else {
                top.MessageBox.Alert("请先选择其中一项");
                return;
            }
        }
        //删除事件
        function btnDelete_Click() {
            var checks = GET_CHECKS();
            if (checks.length == 0) {
                top.MessageBox.Alert("请至少选中一项");
                return;
            }
            if (!confirm('是否删除?')) {
                return;
            }
            else {
                //弹出确定按钮
                var option = {};
                option.Type = "confirm";
                //option.Title="提示"
                option.Msg = "你确定删除票据（共" + checks.length + "项）？"
                option.YesCallback = function (index) {
                    top.layer.close(index);
                    var str = "";
                    var type = "";
                    for (var i = 0; i < checks.length; i++) {
                        str += checks[i].Key;
                        type += checks[i].Type;
                        if (i + 1 != checks.length) {
                            str += ",";
                            type += ",";
                        }
                    }
                    $("#DELETE_CHECK_IDS").val(str);
                    $("#HiddenField1").val(type);
                    $("#ENTRUST_DELETE_BTN").click();

                };
                top.MessageBox.Show(option);
            }
        }

        //获取选中的项 （类型对象数组,Item Key 选中项的主键）
        function GET_CHECKS() {
            var data = [];
            $("#grvShow1 td :checkbox").each(function () {
                if ($(this).is(":checked")) {
                    var key = $(this).attr("data-id");
                    var type = $(this).attr("data-type");
                    data.push({ Key: key, Type: type });
                }
            })
            return data;
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
        <asp:Button runat="server" ID="ENTRUST_DELETE_BTN" OnClick="btnDelete_Click" CssClass="hide" />
        <asp:HiddenField runat="server" ID="DELETE_CHECK_IDS" />
        <asp:HiddenField runat="server" ID="HiddenField1" />
        <div class="Window" style="min-width: 1100px;">
            <div class="Header" style="height: 79px;">
                <table border="0" cellpadding="0" cellspacing="0" width="100%" class="table">
                    <tr>
                        <td style="width: 7%; text-align: right; padding-right: 5px;">出票公司：
                        </td>
                        <td style="width: 20%; text-align: left; padding-left: 10px;">
                            <uc2:CtrlCompany runat="server" ID="FORM_COMPANY_ID" Width="170px" />
                        </td>
                        <td style="width: 7%; text-align: right; padding-right: 5px;">支付银行：
                        </td>
                        <td style="width: 20%; text-align: left; padding-left: 10px;">
                            <asp:DropDownList ID="FORM_BANK_ID" runat="server" Width="170px">
                            </asp:DropDownList>
                        </td>
                        <td style="width: 7%; text-align: right; padding-right: 5px;">出票日期：
                        </td>
                        <td style="width: 20%; text-align: left; padding-left: 10px;">
                            <input id="FORM_BEGIN_DATE" runat="server" class="Wdate" style="width: 85px;" type="text"
                                onclick="WdatePicker()" />
                            至
                        <input id="FORM_OVER_DATE" runat="server" class="Wdate" style="width: 85px;" type="text"
                            onclick="WdatePicker()" />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 7%; text-align: right; padding-right: 5px;">出票账户：
                        </td>
                        <td style="width: 15%; text-align: left; padding-left: 10px;">
                            <input id="txtDRAWERACCOUNT" runat="server" value="" class="lblName" style="width: 168px;" />
                        </td>
                        <td style="width: 7%; text-align: right; padding-right: 5px;">票据类型：
                        </td>
                        <td style="width: 20%; text-align: left; padding-left: 10px;" colspan="3">
                            <asp:DropDownList ID="FORM_Type" runat="server" Width="170px">
                                <asp:ListItem Value="-1">---请选择---</asp:ListItem>
                                <asp:ListItem Value="1">商业汇票</asp:ListItem>
                                <asp:ListItem Value="2">银行本票</asp:ListItem>
                                <asp:ListItem Value="3">转账支票</asp:ListItem>
                                <asp:ListItem Value="4">现金支票</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="6">
                            <asp:Button ID="btnSelect" runat="server" Text="查询" CssClass="bt_css_s" OnClick="btnSelect_Click" />&nbsp;
                        <%--<asp:Button ID="btnEdit" runat="server" Text="编辑" CssClass="bt_css_s" OnClick="btnEdit_Click"
                            OnClientClick="return ValidateEdit();" />--%>
                            <button type="button" class="bt_css_s" onclick="btnEdit_Click()">编辑</button>&nbsp;
                        <%--<asp:Button ID="btnDelete" runat="server" Text="删除" CssClass="bt_css_s" OnClientClick="btnDelete_Click()" />&nbsp;--%>
                            <button type="button" class="hide" onclick="btnDelete_Click()">删除</button>
                            <%--<asp:Button ID="btnDaoChu" runat="server" Text="导出" CssClass="bt_css_s" OnClick="btnDaoChu_Click" />&nbsp;
                        <asp:Button ID="btnPrint" runat="server" Text="打印" CssClass="bt_css_s" OnClick="PRINT_CLICK" />--%>
                        </td>
                    </tr>
                </table>
            </div>
            <div class="Content" style="top: 102px;">
                <div class="Pg-Content">
                    <asp:ScriptManager ID="ScriptManagers" runat="server" EnablePageMethods="True" EnableScriptGlobalization="True"
                        EnableScriptLocalization="True">
                    </asp:ScriptManager>
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                        <ContentTemplate>
                            <asp:GridView ID="grvShow1" runat="server" AutoGenerateColumns="False" CssClass="cont_list zebra"
                                Width="100%" EmptyDataText="没有查找到您要的数据" AllowSorting="True" OnSorting="grvShow1_Sorting">
                                <Columns>
                                    <asp:BoundField DataField="ID" HeaderText="票据ID" SortExpression="ID" ItemStyle-Width="5%"
                                        ItemStyle-CssClass="hide" HeaderStyle-CssClass="hide" />
                                    <asp:TemplateField ItemStyle-Width="5%">
                                        <HeaderTemplate>
                                            <asp:CheckBox ID="chkSelectAll" runat="server" Onclick="GetAllCheckBox(this)" />
                                        </HeaderTemplate>
                                        <ItemTemplate>
                                            <input <%#Eval("N_ID")==DBNull.Value?"class='hide'":"" %> type="checkbox" data-id="<%#Eval("ID")%>" data-type="<%#Eval("TYPE")%>" />
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="TYPENAME" HeaderText="票据种类" SortExpression="TYPE" ItemStyle-Width="7%" />
                                    <asp:BoundField DataField="CMY_NAME" HeaderText="出票人公司名称" SortExpression="CMY_NAME"
                                        ItemStyle-Width="10%" />
                                    <asp:BoundField DataField="C_NAME" HeaderText="出票人银行名称" SortExpression="C_NAME" ItemStyle-Width="10%" />
                                    <asp:BoundField DataField="ACCOUNT" HeaderText="出票人账户" SortExpression="ACCOUNT" ItemStyle-Width="10%" />
                                    <asp:BoundField DataField="PAY_AMOUNT" HeaderText="出票金额" SortExpression="PAY_AMOUNT"
                                        ItemStyle-Width="5%" />
                                    <asp:BoundField DataField="START_DATE" HeaderText="出票日期" SortExpression="START_DATE"
                                        ItemStyle-Width="10%" />
                                    <asp:BoundField DataField="DE_CODE" HeaderText="票据编号" SortExpression="DE_CODE" ItemStyle-Width="7%" />
                                    <asp:BoundField DataField="REMARK" HeaderText="备注" SortExpression="REMARK" ItemStyle-CssClass="left" ItemStyle-Width="10%" />
                                    <%--<asp:TemplateField HeaderText="编辑详细" ItemStyle-Width="4%">
                                    <ItemTemplate>
                                        <input type="image" src="../../Images/folder.png" style="width: 20px; height: 15px;"
                                            onclick='FORM_EDIT(<%#Eval("ID") %>,<%#Eval("TYPE") %>);' title="查看编辑详细" />
                                    </ItemTemplate>
                                </asp:TemplateField>--%>
                                </Columns>
                            </asp:GridView>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
                <div class="Pg">
                    <uc1:Pagination ID="PageIng" runat="server" OnDataBinding="PageIng_DataBinding" Visible="false" />
                </div>
            </div>
        </div>
    </form>
</body>
</html>